package com.eveinfo.sql.data;

public class Attribute {

	private final int attributeID;
	private final String displayName;
	private final int categoryID;
	private final Integer valueInt;
	private final Float valueFloat;

	public Attribute(int attributeID, String displayName, int categoryID, int valueInt) {
		this.attributeID = attributeID;
		this.displayName = displayName;
		this.categoryID = categoryID;
		this.valueInt = valueInt;
		this.valueFloat = null;
	}

	public Attribute(int attributeID, String displayName, int categoryID, float valueFloat) {
		this.attributeID = attributeID;
		this.displayName = displayName;
		this.categoryID = categoryID;
		this.valueInt = null;
		this.valueFloat = valueFloat;

	}

	public int getAttributeID() {
		return attributeID;
	}

	public String getDisplayName() {
		return displayName;
	}

	public Integer getValueInt() {
		return valueInt;
	}

	public Float getValueFloat() {
		return valueFloat;
	}

	public String getValue() {
		if (valueFloat == null) {
			return Integer.toString(valueInt);
		} else {
			return Float.toString(valueFloat);
		}
	}

	public int getCategoryID() {
		return categoryID;
	}

	@Override
	public String toString() {
		if (valueInt != null) {
			return displayName + " " + valueInt;
		}else{
			return displayName + " " + valueFloat;
		}
	}
}
